package com.hyq.proxy.dynamicmodel;

import java.lang.reflect.InvocationHandler;

/**
* @ClassName: SubjectDynamicProxy 
* @Description: 具体动态代理实现类
* @author Janus
 */
public class SubjectDynamicProxy extends DynamicProxy {
	//动态代理实现方法
	public static <T> T newProxyInstance(Subject subject){
			//获得ClassLoader
			ClassLoader loader = subject.getClass().getClassLoader();
			//获得接口数组
			Class<?>[] classes = subject.getClass().getInterfaces();
			//获得handler
			InvocationHandler handler = new MyInvocationHandler(subject);
			return newProxyInstance(loader, classes, handler);
		}
}
